package com.atguigu.crowd.mapper;

import com.atguigu.crowd.entity.Admin;
import com.atguigu.crowd.entity.Role;
import com.atguigu.crowd.entity.RoleExample;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface RoleMapper {
    int countByExample(RoleExample example);

    int deleteByExample(RoleExample example);

    int deleteByPrimaryKey(Integer id);

    int insert(Role record);

    int insertSelective(Role record);

    List<Role> selectByExample(RoleExample example);

    Role selectByPrimaryKey(Integer id);

    int updateByExampleSelective(@Param("record") Role record, @Param("example") RoleExample example);

    int updateByExample(@Param("record") Role record, @Param("example") RoleExample example);

    int updateByPrimaryKeySelective(Role record);

    int updateByPrimaryKey(Role record);

    /**
     * @return java.util.List<com.atguigu.crowd.entity.Role>
     * @Description 根据keyword查找信息
     * @Author zzqstart
     * @Date 2022/9/3 20:56
     * @Param [keyword]
     **/
    List<Role> selectRoleByKeyword(@Param("keyword") String keyword);

    /**
     * @Description 查询已分配给该admin的角色
     *
     * @Author zzqstart
     * @Date 2022/9/6 2:20
     * @Param [adminId]
     * @return java.util.List<com.atguigu.crowd.entity.Role>
     **/
    List<Role> selectAssignedRole(@Param("adminId") Integer adminId);

    /**
     * @Description 查询未分配给该admin的角色
     *
     * @Author zzqstart
     * @Date 2022/9/6 2:31
     * @Param [adminId]
     * @return java.util.List<com.atguigu.crowd.entity.Role>
     **/
    List<Role> selectUnAssignedRole(@Param("adminId") Integer adminId);

    void deleteAdminRoleByAdminId(@Param("adminId") Integer adminId);

    void insertAdminRoleRelationship(@Param("adminId") Integer adminId,@Param("roleIdList") List<Integer> roleIdList);
}